<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Title</title>
    <style>
        *{
            padding:0;
            margin: 0;
        }
        html,body{
            height: 100%;
        }
        #mask{
            position: absolute;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            text-align: center;
            font-size: 30px;
            background:rgba(1,1,1,0.5);
        }
        #mask h3{
            color:red;
        }
        #mask button{
            padding:5px
        }
        /*img{*/
        /*    pointer-events: none;*/
        /*}*/
    </style>
</head>
<body>
<a href="https://baidu.com"><img style="width:100%" src="img/1.jpg" alt=""></a>
<div id="mask">
    <h3>恭喜您， 中奖啦</h3>
    <button>关闭</button>
</div>
</body>
<script>
    //  如果 touch 事件隐藏了元素，则 click 动作将作用到新的元素上，触发新元素的 click 事件或页面跳转，
    //  此现象称为点击穿透
    const btn = document.querySelector("button");
    const mask = document.querySelector("#mask");
    const img = document.querySelector("img");
    btn.addEventListener("touchstart",function(){
        img.style.pointerEvents="none";
        mask.style.display = "none";
        setTimeout(()=>{
            img.style.pointerEvents="auto";
        },500)
    })
</script>
</html>